package cn.stylefeng.guns.modular.rest.dict;

import cn.stylefeng.guns.sys.modular.system.model.result.DictResult;
import cn.stylefeng.guns.sys.modular.system.service.DictService;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/rest/dict")
public class RestDictController {

    @Autowired
    private DictService dictService;

    @RequestMapping("/list")
    @ResponseBody
    public ResponseData list(String code) {
        List<DictResult> zxd = dictService.getDictListByType(code);
        ResponseData responseData = ResponseData.success();
        responseData.setData(zxd);
        return responseData;
    }
}
